<template>
  <div class="text">
    <span v-if="!isElIcon" class="iconfont" :class="'icon-' + code"></span>
    <i :class="code" v-if="isElIcon"></i>
    {{ text }}
  </div>
</template>
<script>
export default {
  name: "icon",
  props: ["code", "text"],
  computed: {
    isElIcon() {
      //判断是否为element icon
      return this.code.startsWith("el-");
    },
  },
};
</script>
<style scoped>
.icon {
  width: 20px;
  height: 20px;
  vertical-align: -5px;
}
</style>
